﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<Model.ViewModels.ApartmentListAdminVm>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Stanovi
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2>Pregled stanova</h2>

    Filtriraj prema modelu stana: 
    <% using (Html.BeginForm("FilterModel", "Admin", FormMethod.Post)){%>
        <input type="text" id="filterModel" name="filterModel" /> 
        <input type="submit" id="submitBtnFilterModel" name="submitBtnFilterModel" value="Filtriraj" />        
     <% } %>  

     <hr />

    Filtriraj prema kodu stana: 

     <% using (Html.BeginForm("FilterCode", "Admin", FormMethod.Post)){%>
        <input type="text" id="filterCode" name="filterCode" /> 
        <input type="submit" id="submitBtn" name="submitbtn" value="Filtriraj" />        
     <% } %>  
         

    <br />
    <hr />
    <br />

    <table>
        <tr>  
            <th>
                Id
            </th>         
            <th>
                Kod
            </th>
            <th>
                Zgrada
            </th>
            <th>
                Stanje
            </th>
            <th>
                Kat
            </th>
            <th>
                Broj soba
            </th>
            <th>
                Pročelje
            </th>
            <th>
                Model
            </th>
            <th>
                Cijena
            </th>
            <th>
                Površina
            </th>
            <th>
                Dvoetažan
            </th>
            <th></th>
        </tr>

    <% foreach (var item in Model) { %>
    
        <tr> 
            <td>
                <%: item.Id %>
            </td>           
            <td>
                <%: item.Code %>
            </td>
            <td>
                <%: item.Building %>
            </td>
            <td>
                <%: item.State %>
            </td>
            <td>
                <%: item.Floor %>
            </td>
            <td>
                <%: item.NumOfRooms %>
            </td>
            <td>
                <%: item.Facade %>
            </td>
            <td>
                <%: item.Model %>
            </td>
            <td>
                <%: String.Format("{0:F}", item.Price) %>
            </td>
            <td>
                <%: String.Format("{0:F}", item.Area) %>
            </td>
            <td>
                <% if (item.HasTwoFloors) {%>
                    Da
                <% } %>
                <% else {%>
                    Ne
                <% } %>
            </td>
            <td>
                <%: Html.ActionLink("Uredi", "EditApartment", new { id=item.Id })%> |
                <%: Html.ActionLink("Izbriši", "DeleteApartment", new { id=item.Id })%> |
                <%: Html.ActionLink("Prostorije", "Rooms", new { id=item.Id })%> 
                <%--<%: Html.ActionLink("Generiraj prostorije", "GenerateRoom", new { id = item.Id })%>--%>
            </td>
        </tr>
    
    <% } %>

    </table>    

</asp:Content>

